﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ValidationRules="clr-namespace:Alfa.Common.ValidationRules;assembly=Alfa.Common" x:Class="WpfApplication1.MainWindow"
        Title="MainWindow" Height="350" Width="525">
	<Grid ShowGridLines="True">
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="1*"/>
			<ColumnDefinition Width="Auto"/>
			<ColumnDefinition Width="1*"/>
			<ColumnDefinition Width="Auto"/>
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="2*"/>
			<RowDefinition Height="2*"/>
			<RowDefinition Height="2*"/>
			<RowDefinition Height="2*"/>
			<RowDefinition Height="2*"/>
			<RowDefinition Height="2*"/>
			<RowDefinition Height="2*"/>
		</Grid.RowDefinitions>
		<TextBox x:Name="text" Grid.Column="1" Height="23" Width="150" Style="{DynamicResource FrameworkElementInError}">
			<Binding Path="Text">
				<Binding.ValidationRules>
					<ValidationRules:StringLengthValidationRule/>
					<ValidationRules:NotNullValidationRule/>
					<ValidationRules:NotEmptyValidationRule/>
				</Binding.ValidationRules>
			</Binding>
		</TextBox>
		<TextBox Grid.Column="1" Height="23" Width="150" Grid.Row="1">
			<Binding Path="Numeric">
				<Binding.ValidationRules>
					<ValidationRules:NumericRangeValidationRule/>
				</Binding.ValidationRules>
			</Binding>
		</TextBox>
		<TextBox Grid.Column="1" Height="23" Width="150" Grid.Row="2">
			<Binding Path="Decimal">
				<Binding.ValidationRules>
					<ValidationRules:DecimalRangeValidationRule Nullable="True" Min="2"/>
				</Binding.ValidationRules>
			</Binding>
		</TextBox>
		<TextBox Grid.Column="1" Height="23" Width="150" Grid.Row="3">
			<Binding Path="Pesel" Mode="OneWay">
				<Binding.ValidationRules>
					<ValidationRules:PeselValidationRule/>
				</Binding.ValidationRules>
			</Binding>
		</TextBox>
		<TextBox Grid.Column="3" Height="23" Width="150">
			<Binding Path="TextDate">
				<Binding.ValidationRules>
					<ValidationRules:DateValidationRule/>
				</Binding.ValidationRules>
			</Binding>
		</TextBox>
		<TextBox Grid.Column="3" Height="23" Width="150" Grid.Row="1">
			<Binding Path="TextTime">
				<Binding.ValidationRules>
					<ValidationRules:TimeValidationRule/>
				</Binding.ValidationRules>
			</Binding>
		</TextBox>
		<TextBox Grid.Column="3" Height="23" Width="150" Grid.Row="2">
			<Binding Path="TextDateTime">
				<Binding.ValidationRules>
					<ValidationRules:DateTimeValidationRule/>
				</Binding.ValidationRules>
			</Binding>
		</TextBox>
		<TextBox Grid.Column="3" Height="23" Width="150" Grid.Row="3">
			<Binding Path="TextFormated">
				<Binding.ValidationRules>
					<ValidationRules:StringRegexValidationRule Regex=".*"/>
				</Binding.ValidationRules>
			</Binding>
		</TextBox>

		<TextBlock HorizontalAlignment="Center" TextWrapping="Wrap" Text="Text" VerticalAlignment="Center"/>
		<TextBlock HorizontalAlignment="Center" Grid.Row="1" Margin="10,5" TextWrapping="Wrap" Text="Numeric" VerticalAlignment="Center"/>
		<TextBlock HorizontalAlignment="Center" Grid.Row="3" Margin="10,5" TextWrapping="Wrap" Text="Pesel" VerticalAlignment="Center"/>
		<TextBlock HorizontalAlignment="Center" Grid.Row="2" Margin="10,5" TextWrapping="Wrap" Text="Decimal" VerticalAlignment="Center"/>
		<TextBlock HorizontalAlignment="Center" Grid.Row="4" Margin="10,5" TextWrapping="Wrap" Text="Combo" VerticalAlignment="Center"/>
		<TextBlock HorizontalAlignment="Center" Grid.Row="5" Margin="10,5" TextWrapping="Wrap" Text="EditableCombo" VerticalAlignment="Center"/>
		<TextBlock HorizontalAlignment="Center" Grid.Row="6" Margin="10,5" TextWrapping="Wrap" Text="Date" VerticalAlignment="Center"/>

		<TextBlock HorizontalAlignment="Center" Grid.Column="2" TextWrapping="Wrap" Text="Date" VerticalAlignment="Center"/>
		<TextBlock HorizontalAlignment="Center" Grid.Column="2" Grid.Row="1" Margin="10,5" TextWrapping="Wrap" Text="Time" VerticalAlignment="Center"/>
		<TextBlock HorizontalAlignment="Center" Grid.Column="2" Grid.Row="3" Margin="10,5" TextWrapping="Wrap" Text="Formated" VerticalAlignment="Center"/>
		<TextBlock HorizontalAlignment="Center" Grid.Column="2" Grid.Row="2" Margin="10,5" TextWrapping="Wrap" Text="DateTime" VerticalAlignment="Center"/>
		<TextBlock HorizontalAlignment="Center" Grid.Column="2" Grid.Row="4" Margin="10,5" TextWrapping="Wrap" Text="Check" VerticalAlignment="Center"/>
		<TextBlock HorizontalAlignment="Center" Grid.Column="2" Grid.Row="5" Margin="10,5" TextWrapping="Wrap" Text="Radio" VerticalAlignment="Center"/>
		<TextBlock HorizontalAlignment="Center" Grid.Column="2" Grid.Row="6" Margin="10,5" TextWrapping="Wrap" Text="Time" VerticalAlignment="Center"/>

		<ComboBox x:Name="comboBox" Grid.Column="1" HorizontalAlignment="Center" Grid.Row="4" Width="120" Height="22" VerticalAlignment="Center">
			<ComboBox.Items>
				<x:Null/>
				<ComboBoxItem Content="1" />
				<ComboBoxItem Content="2" />
				<ComboBoxItem Content="3" />
				<ComboBoxItem Content="4" />
				<ComboBoxItem Content="5" />
			</ComboBox.Items>
			<ComboBox.SelectedItem>
				<Binding Path="Combo" UpdateSourceTrigger="PropertyChanged">
					<Binding.ValidationRules>
						<ValidationRules:RequiredValidationRule/>
					</Binding.ValidationRules>
				</Binding>
			</ComboBox.SelectedItem>
		</ComboBox>
		<ComboBox Grid.Column="1" HorizontalAlignment="Center" Grid.Row="5" VerticalAlignment="Center" Width="120" Height="22" IsEditable="True"/>
		<DatePicker Grid.Column="1" HorizontalAlignment="Center" Grid.Row="6" VerticalAlignment="Center" Height="24" Width="120">
			<DatePicker.SelectedDate>
				<Binding Path="Date">
					<Binding.ValidationRules>
						<ValidationRules:DateValidationRule/>
					</Binding.ValidationRules>
				</Binding>
			</DatePicker.SelectedDate>
		</DatePicker>
		<CheckBox Content="CheckBox" Grid.Column="3" HorizontalAlignment="Center" Grid.Row="4" VerticalAlignment="Center"/>
		<RadioButton Content="RadioButton" Grid.Column="3" HorizontalAlignment="Center" Grid.Row="5" VerticalAlignment="Center"/>
		<Button Content="Button" Grid.Column="3" HorizontalAlignment="Left" Margin="33,14,0,0" Grid.Row="6" VerticalAlignment="Top" Width="74" Click="Button_Click"/>

	</Grid>
</Window>
